package com.yx.pay.alipay;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2017120700437346";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDawxCKHd96F+vLU5gt7G6BlCUx7+41fE0mkMc3qn7qLEqXpS4ZnV4kT9v+p1tNayp+hf/hHnuiTcplOEfU+Ctrf2BJDTXkTibtLs4qXovxKNqZyEMTXGemI/+BEl5VjI/PTHuN8danFUkY6xrVJtAr5WN419LlizdxSp9poOubTOCwXlTZYKsDzl87XGjKrB/jjb51yaMLps7eW39WL9LUsL/iOER7Cn+6aAI0wbBIN6cvSOVPOgiqwdpQ8xSqmlz5SpyqNizGwIOi5QIyNHUtnas6Y/XgjVjiweI6MjaKIpFhDTZw/tkOzdLW7ULYOQqWNB3YFdBaAs/rthMrziqzAgMBAAECggEAMn9Emh07MNvEujKZtkAVYiPoUhaoTgBbbsOMuPTKRxPiRA8FDTSePpOQnL/U+5H5RSt5XWXD9DswtRzAuBBxNWc5uqMqBYFkyus6+9zHQOvFSipIEXgLFPbKS+kJjYXczGVDQAjLG9Z2ASKEFx/Wfct9oq9vJz1zlts64Q8cU8SF7tkTV6rbPnBzzC07SzEa1DmEoVZkKQgV7XBkveppsG1D2VCnXgjT5QuiHQBCgEOK+qt3GgcvrSSxZRwWSgfOlhWEw+XMnXI4iy6zZIPP4/bLmrPqtMRV4Qka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fXX/SPh+DOAl9kZuFihrbisUZdBpnK3ejE2VslbkTntvoaB0DEuBA5nNX38wTfSGS0ykQ08Ii36ZK06ghQ8BmUC2/YPT7+RU/AdMLDoq1LfvLTZZsg5U3pIusELDKVhaeuJjhjuO3kgZd96/SWXI9ZH69cYBAoGATZwZ2rvc/o95TND02CG1H5S5gnZqjWofG8q5JxXQySt0bIwRMrSudH4EhVLsGyUXh02pimi3cfoIMcBuHm1tc85zgP4P2L/RzXgqL8LxPplVkV/Sc4IiDw/0pyfx5s41kIHBoysIxXribElitWDK2mjTy2g4x2ZS2WEei/reRpk=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2sMQih3fehfry1OYLexugZQlMe/uNXxNJpDHN6p+6ixKl6UuGZ1eJE/b/qdbTWsqfoX/4R57ok3KZThH1Pgra39gSQ015E4m7S7OKl6L8SjamchDE1xnpiP/gRJeVYyPz0x7jfHWpxVJGOsa1SbQK+VjeNfS5Ys3cUqfaaDrm0zgsF5U2WCrA85fO1xoyqwf442+dcmjC6bO3lt/Vi/S1LC/4jhEewp/umgCNMGwSDenL0jlTzoIqsHaUPMUqppc+UqcqjYsxsCDouUCMjR1LZ2rOmP14I1Y4sHiOjI2iiKRYQ02cP7ZDs3S1u1C2DkKljQd2BXQWgLP67YTK84qswIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://www.youwenyuedu.com:8080/youxiang/api/user/notify_url";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://www.youwenyuedu.com/#/PaySuccess";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

